package com.easywb.springboot.err;


import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@ControllerAdvice(basePackages = "com.easywb.springboot.controller")
public class errData {
    @ExceptionHandler(RuntimeException.class)
    @ResponseBody
    public Map errData(RuntimeException runtimeException) {
        Map<Object, Object> errData = new HashMap<>();
        errData.put("statusCode", 5000);
        errData.put("mes", runtimeException.getMessage());
        return errData;
    }
}
